#include<unistd.h>
char toupper(char a);
int del_part(string s);
string part_name_handle(string s);
string store_path();
bool is_same_path(string path1, string path2);
void store_path_in_file(string path);
string file_path(string s)
{
    char buf[255];
    getcwd(buf,255);
    string pos_path(buf);
    string real_path;
    int index = del_part(s);
    if(!index)
    {
        if(is_win_os()) real_path = pos_path + "\\" + s;
        else real_path = pos_path + "/" + s;
        return real_path;
    }
    return s;
}
string part_name_handle(string s)
{
    string return_path;
    return_path = s.substr(0, del_part(s));
    return return_path;
}
int del_part(string s)
{
    int index = s.size()-1;
    while(index >= 0 && s[index--] != '\\');
    return index+1;
}
bool is_same_path(string path1, string path2)
{
    path1[0] = toupper(path1[0]), path2[0] = toupper(path2[0]);
    return path1.compare(path2) == 0;
}
char toupper(char a)
{
    if(a >= 'a' && a <= 'z')
        return a - 32;
    return a;
}
void store_path_in_file(string path)
{
    ofstream fout("path.txt");
    fout << path << endl;
    fout.close();
}
string store_path()
{
    ifstream fin("path.txt");
    if(!fin)
    { 
        cout << "Git 仓库不存在" << endl; 
        exit(0);
    }
    string s;
    getline(fin, s);
    return s;
}